// JavaScript Document
 var fileLocation ='js/echarts';
require.config({
   
    paths:{ 
         echarts: fileLocation,
            'echarts/chart/line': fileLocation,
            'echarts/chart/bar': fileLocation,
            'echarts/chart/pie': fileLocation
    }
});

// 作为入口
require(
    [
        'echarts',
        'echarts/chart/bar'
    ], 
	
	displayChart
    
);

function displayChart(ec) {
		//柱状图
		var barChart = ec.init(document.getElementById('bar'));
		var barChartOtion = getBarChartOption();	
        barChart.setOption(barChartOtion);
    }
	
	//获得Bar图的选项和数据
	function getBarChartOption(){
	var option = {
    tooltip : {
        show: true,
        trigger: 'item'
    },
    legend: {
        data:['本月请假人员天数统计']
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: false},
            dataView : {show: false, readOnly: false},
            magicType : {show: false, type: ['line', 'bar']},
            restore : {show: false},
            saveAsImage : true
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            data : ['张三','里斯','王二','小样','无恙','周磊','洋洋']
        }
    ],
    yAxis : [
        {
            type : 'value',
            splitArea : {show : true}
        }
    ],
    series : [
        
        {
            name:'本月请假人员天数统计',
            type:'bar',
            barWidth: 40,                   // 系列级个性化，柱形宽度
            itemStyle: {
                normal: {                   // 系列级个性化，横向渐变填充
                    borderRadius: 5,
                    color : (function(){
                        var zrColor = require('zrender/tool/color');
                        return zrColor.getLinearGradient(
                            0, 0, 1000, 0,
                            [[0, 'rgba(30,144,255,0.8)'],[1, 'rgba(138,43,226,0.8)']]
                        )
                    })(),
                    label : {
                        show : true,
                        textStyle : {
                            fontSize : '20',
                            fontFamily : '微软雅黑',
                            fontWeight : 'bold'
                        }
                    }
                }
            },
            data:[
                6, 3, 1, 4, 8, 3, 2]
        }
    ]
};

return option;
                    
	}
	
	